from django.db import models


# Create your models here.

# 用户表
class Users(models.Model):
    username = models.CharField(max_length=20, verbose_name='用户名')
    moile = models.CharField(max_length=11, verbose_name='手机号')
    password = models.CharField(max_length=20, verbose_name='密码')
    img = models.ImageField(upload_to='userimg/', verbose_name='头像')

    def __str__(self):
        return self.username

    class Meta:
        db_table = 'users'
        verbose_name = '用户表'


# 第三方登陆表
class ThirdParty(models.Model):
    PARTY_TYPE = (
        (1, '微信'),
        (2, 'QQ'),
        (3, '钉钉'),
    )
    user = models.ForeignKey(Users, on_delete=models.CASCADE, verbose_name='用户')
    party_type = models.IntegerField(choices=PARTY_TYPE, verbose_name='第三方类型')
    uid = models.CharField(max_length=255, verbose_name='第三方唯一标识')

    def __str__(self):
        return self.user.username

    class Meta:
        db_table = 'thirdparty'
        verbose_name = '第三方登陆表'


# #身份认证表
# class User_identity(models.Model):
#     user=models.ForeignKey(Users,on_delete=models.CASCADE,verbose_name='用户')
#     name=models.CharField(max_length=20,verbose_name='姓名')
#     id_card=models.CharField(max_length=18,verbose_name='身份证号')
#     class Meta:
#         db_table='user_identity'
#         verbose_name='身份认证表'


